How to use the EIC325PCI.DLL in Visual C (available only in WinNT/2K/XP):
=========================================================================

The following sequence instructs how to build an application
using the DLL. The sample application demonstrates a basic
connection with the card(s) by letting flash ten times the two
LEDs of all detected cards upon pressing a button.

 1. Create a new Visual C project ('File', 'New', 'Projects',
    'MFC AppWizard(exe)'), specify the 'Project name' and press
    'OK'.

 2. In step 1 of the AppWizard select 'Dialog based'.
    Other selections of the AppWizard are OK (press 'Finish').

 3. Copy the EIC325PCI.LIB file from the 'DLL for WinNT and
    Win2000' folder to your just created Visual C project folder.
    This file contains the import library for the DLL and should
    be known to the Visual C linker in order to build your
    application's executable file. Therefore, you have to specify
    file's name (EIC325PCI.lib) in the 'Object/library modules'
    text box on the 'Link' tab of the 'Project Settings' dialog
    box.

 4. In order to make the DLL functions (such as SetLed) and the
    symbolic constants (such as LedRed) recognizable to your code:
    * Copy the 'EncPciFunctions.h' and 'EncPciConst.h' files from
      this folder to your new Visual C project folder.
    * Add those files to the project ('Project', 'Add To Project',
      'Files', select 'EncPciFunctions.h' and 'EncPciConst.h',
      'OK').
    * In dialog's source file (...Dlg.cpp), after the three
      standard #include statements, add the following lines:
      #include "EncPciFunctions.h"
      #include "EncPciConst.h"

 5. Next to the above #include's, add the following application's
    constant and variables:
    #define MAX_PCI_CARDS 10
    // (MAX_PCI_CARDS is rather arbitrary. The array below has
    // MAX_PCI elements, indexed 0 through MAX_PCI_CARDS-1.)
    long CardHandleArray[MAX_PCI_CARDS-1] ;
    short CardsDetected ;

 6. Initialization sequence:
    In the same file (...Dlg.cpp), in the OnInitDialog routine,
    after the line -
	// TODO: Add extra initialization here
    - add the following code:
                char msg [200] ;
                long CardHandle ;
		short CardIndex ;
		short OK ;  // 0 = Success, 1 = Failure.
		SetActive(1);
        // Locate all the existing EIC-325/PCI cards:
		for (CardIndex = 0 ; (CardIndex < MAX_PCI_CARDS) ; CardIndex++) {
			OK = GetCardHandle (&CardHandle, CardIndex) ;
			if (OK == 0) break ;  // No more cards.

            // (EIC-325/PCI card detected.)

            // Store the result in an array:
            CardHandleArray[CardIndex] = CardHandle ;
		}

        // Report how many cards were detected:
        // Note that current CardIndex = how many cards were detected.
        CardsDetected = CardIndex ;
        switch (CardsDetected) 
        {
            case 0:
				MessageBox("No 'EIC-325/PCI' cards detected!", NULL, MB_ICONSTOP) ;
				exit(0) ;
                break ;
            case 1:
				MessageBox("One 'EIC-325/PCI' card detected.") ;
				break ;
            default:
                sprintf (msg, "%d 'EIC-325/PCI' cards were detected. The 'Flash' will apply sequentially to all recognized cards.", CardsDetected) ;
				MessageBox(msg) ;
                break ;
        }

 7. Enter the dialog (double-click the second item under
    ResourceView, Dialog).

 8. If the dialog editor's toolbox (titled 'Controls') is not
    visible, right-click the mouse on a free space in the dialog
    and check the 'Controls' entry.

 9. De-initialization sequence:
    * Edit the OnOK routine by the following sequence:
      * Double-click the 'OK' button
      * Double-click 'BN_CLICKED'
      * Click 'OK'
      * Click 'Edit Existing'
    * After the 'TODO' line, add to the OnOK routine the following
      statement:
        SetActive(0);

10. To insert the main functionality to the application:
    * Add a new button, say 'Flash'.
    * Edit its OnFlash routine by the following sequence:
      * Double-click the new button
      * Double-click 'BN_CLICKED'
      * Click 'OK'
      * Click 'Edit Existing'
    * After the 'TODO' line, add to the OnFlash routine the
      following code:
	// Flash the LEDs of all detected card(s):
        for (short CardIndex = 0 ; CardIndex < CardsDetected ; CardIndex++) {
        	long CardHandle = CardHandleArray[CardIndex] ;
        	for (int i=1 ; i<=10 ; i++ ) {
        		SetLed(CardHandle,LedYellow,TurnOff);
        		SetLed(CardHandle,LedRed,TurnOn);
        		Sleep(100);
        		SetLed(CardHandle,LedYellow,TurnOn);
        		SetLed(CardHandle,LedRed,TurnOff);
        		Sleep(100);
        	}
        }
    * Make some 'cosmetics' such as removing unnecessary elements
      in the dialog ('TODO' and 'Cancel'), etc.

11. The code of the sample application is ready. Build the
    executable and run it. Pressing the new button should flash
    ten times the two LEDs of all detected cards, indicating that
    your application communicates well with the card via the DLL.


Note
----
The folder EncPciBasicTest includes a sample basic project that
was created according to the instructions above. The output files
generated by Visual C builder are directed to the folder Debug,
but are not supplied, as these are big files and may be reproduced
easily by the user running 'Rebuild All'. Though, the main output
file (EncPciBasicTest.exe) is supplied in the 'EncPciBasicTest'
folder. It was not put in the Debug folder in order to avoid
conflict when the user runs 'Rebuild All'.